package com.gnerv.pabu.test.org;

import com.gnerv.pabu.test.org.auto.Swagger2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@SpringBootApplication
@EnableDiscoveryClient
@CrossOrigin
@RestController
public class OrgApplication {

    @Autowired
    Swagger2 pabuConfigProperties;

    @Value("${server.port}")
    private String port;


    @Value("${spring.cloud.consul.host}")
    private String consulHost;

    public static void main(String[] args) {
        SpringApplication.run(OrgApplication.class, args);
    }

    @RequestMapping(value = "get/{name}", method = RequestMethod.GET)
    public String get(@PathVariable(value = "name") String name) {
        pabuConfigProperties.get();
        return name + "---" + port + "---" + consulHost;
    }

}
